#!/bin/bash

# ***************************************************************************
# * 
# * @file:build_openssl.sh 
# * @author:ebayboy@163.com 
# * @date:2019-11-28 01:49 
# * @version 1.0  
# * @description: Shell script 
# * @Copyright (c)  all right reserved 
#* 
#**************************************************************************/ 

DEST=/usr/local/openssl

function build_openssl()
{
	./config -DOPENSSL_PIC --prefix=$DEST shared zlib || exit 1
	make -j4 && make install
}

function config_openssl()
{
	mv /usr/bin/openssl{,.bak}
	ln -s /usr/local/openssl/include/openssl /usr/include/openssl
	ln -s /usr/local/openssl/lib/libssl.so.1.0.0 /usr/local/lib64/libssl.so
	ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

	echo "/usr/local/openssl/lib" >>/etc/ld.so.conf
	ldconfig -v
	openssl version
}

build_openssl;

config_openssl;

exit 0

